package com.fr.chart.axis;

import com.fr.base.core.json.JSONException;
import com.fr.base.core.json.JSONObject;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.chart.DataSeriesCondition;
import com.fr.chart.base.equals.Equals;
import com.fr.util.Utils;
import java.awt.Color;

public class SeriesAttrColor
  implements DataSeriesCondition
{
  private static final long serialVersionUID = 4943492805520879958L;
  public static final String XML_TAG = "SeriesAttrColor";
  private Color seriesColor = null;

  public SeriesAttrColor()
  {
  }

  public SeriesAttrColor(Color paramColor)
  {
    this.seriesColor = paramColor;
  }

  public void setSeriesColor(Color paramColor)
  {
    this.seriesColor = paramColor;
  }

  public Color getSeriesColor()
  {
    return this.seriesColor;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      String str1 = paramXMLableReader.getTagName();
      if (str1.equals("Attr"))
      {
        String str2;
        if ((str2 = paramXMLableReader.getAttr("Color")) != null)
          setSeriesColor(new Color(Utils.string2Number(str2).intValue(), true));
      }
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("SeriesAttrColor");
    paramXMLPrintWriter.startTAG("Attr");
    if (this.seriesColor != null)
      paramXMLPrintWriter.attr("color", this.seriesColor.getRGB());
    paramXMLPrintWriter.end();
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof SeriesAttrColor))
      return false;
    SeriesAttrColor localSeriesAttrColor = (SeriesAttrColor)paramObject;
    return (Equals.equals(this.seriesColor, localSeriesAttrColor.seriesColor));
  }

  public JSONObject toJSONObject()
    throws JSONException
  {
    JSONObject localJSONObject = new JSONObject();
    localJSONObject.put("seriesColor", this.seriesColor);
    return localJSONObject;
  }

  public String getConditionType()
  {
    return "SeriesAttrColor";
  }
}